package com.cn.wanxi.service.impl;

import com.cn.wanxi.entity.CompanyEntity;
import com.cn.wanxi.mapper.CompanyMapper;
import com.cn.wanxi.service.ICompanyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CompanyServiceImpl implements ICompanyService {

    @Autowired
    private CompanyMapper companyMapper;

    @Override
    public List<CompanyEntity> findAll(CompanyEntity companyEntity) {

        return companyMapper.findAll(companyEntity);
    }

    @Override
    public int getCount(CompanyEntity companyEntity) {

        return companyMapper.getCount(companyEntity);
    }

    @Override
    public int del(Integer id) {

        return companyMapper.del(id);
    }

    @Override
    public CompanyEntity findById(Integer id) {

        return companyMapper.findById(id);
    }

    @Override
    public String edit(CompanyEntity companyEntity) {

        return companyMapper.edit(companyEntity) == 1 ? "success" : "error";
    }

    @Override
    public String add(CompanyEntity companyEntity) {

        return companyMapper.add(companyEntity) == 1 ? "success" : "error";
    }

    /**
     * 前台界面
     * @return
     */
    @Override
    public CompanyEntity getCompany() {

        return companyMapper.getCompany();
    }
}
